gtkmain: Don't process WM events if there's a grab on another toplevel
authorCarlos Garnacho <carlosg@gnome.org>
Tue, 4 Aug 2015 13:49:34 +0000 (15:49 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Tue, 4 Aug 2015 15:58:39 +0000 (17:58 +0200)
This is implicitly done for us in the case of grabs on windows from other
groups, but we must perform this check explicitly for grabs with
owner_events=True on windows from the same group, in that case the window
would handle the events as if there was no grab.

https://bugzilla.gnome.org/show_bug.cgi?id=752327

gtk/gtkmain.c

index 56400971c38dde86ce37e0985b24070b86ef8b72..25fef1cfdfce8b3ab8fda256e18892d4c51f9a65 100644 (file)
@@ -1645,8 +1645,13 @@ gtk_main_do_event (GdkEvent *event)
       (grab_widget && grab_widget != event_widget &&
        !gtk_widget_is_ancestor (event_widget, grab_widget)))
     {
-      if (_gtk_window_check_handle_wm_event (event))
-        goto cleanup;
+      /* Ignore event if we got a grab on another toplevel */
+      if (!grab_widget ||
+          gtk_widget_get_toplevel (event_widget) == gtk_widget_get_toplevel (grab_widget))
+        {
+          if (_gtk_window_check_handle_wm_event (event))
+            goto cleanup;
+        }
     }
 
   /* Find out the topmost widget where captured event propagation